import request from '@/config/axios'

// 秒杀活动关联商品 VO
export interface ActivityTopicProductVO {
  id: number // 主键ID
  topicId: number // 关联的活动主题ID
  spuId: number // 商品SPU ID
}

// 秒杀活动关联商品 API
export const ActivityTopicProductApi = {
  // 查询秒杀活动关联商品分页
  getActivityTopicProductPage: async (params: any) => {
    return await request.get({ url: `/promotion/activity-topic-product/page`, params })
  },

  // 查询秒杀活动关联商品详情
  getActivityTopicProductById: async (id: number) => {
    return await request.get({ url: `/promotion/activity-topic-product/getById?id=` + id })
  },

  // 新增秒杀活动关联商品
  createActivityTopicProduct: async (data: ActivityTopicProductVO) => {
    return await request.post({ url: `/promotion/activity-topic-product/create`, data })
  },

  // 修改秒杀活动关联商品
  updateActivityTopicProduct: async (data: ActivityTopicProductVO) => {
    return await request.post({ url: `/promotion/activity-topic-product/update`, data })
  },

  // 修改秒杀活动关联商品状态
  updateActivityTopicProductStatus: async (id: number, status: number) => {
    const data = {
      id,
      status
    }
    return await request.post({ url: `/promotion/activity-topic-product/updateStatus`, data: data })
  },

  // 删除秒杀活动关联商品
  deleteActivityTopicProductById: async (id: number) => {
    return await request.get({ url: `/promotion/activity-topic-product/delete?id=` + id })
  },

  // 导出秒杀活动关联商品 Excel
  exportActivityTopicProduct: async (params) => {
    return await request.download({ url: `/promotion/activity-topic-product/export-excel`, params })
  },
}
